package uk.co.wroedevelopments.semanticworkbench.actions;

import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;

public class EditorActionDelegate implements IEditorActionDelegate {

	private ISelection selection;
	private IFile selectedFile;
	private Shell shell;

	public void setActiveEditor(IAction arg0, IEditorPart targetPart) {
		shell = targetPart.getSite().getShell();

	}

	public void run(IAction arg0) {
		System.out.println("hello");

	}

	public void selectionChanged(IAction arg0, ISelection arg1) {
		this.selection = selection;
		if (selection instanceof IStructuredSelection) {
			IStructuredSelection selection2 = (IStructuredSelection)selection;
			if (!selection.isEmpty()) {
				Object selection3 = selection2.getFirstElement();
				if (selection3 instanceof IFile) {
					selectedFile = (IFile)selection3;
				}
			}
		}
		
	}

}
